<!DOCTYPE html >
<html>
<head>
    <link rel="stylesheet" href="demos.css" type="text/css" media="screen" />

    <script src="../libraries/RGraph.common.core.js" ></script>
    <script src="../libraries/RGraph.line.js" ></script>
    
    <title>RGraph demo: A Line chart with the X axis in the middle</title>
    
    <meta name="robots" content="noindex,nofollow" />
    <meta name="description" content="A Line chart that shows the various axis options that you can manipulate" />
     
</head>
<body>

    <!-- Share buttons -->
    <p style="float: right">
        <script>
            document.write('<a href="" target="_blank" onclick="window.open(\'https://www.facebook.com/sharer/sharer.php?u=http://www.rgraph.net' + location.pathname + '\', null, \'top=50,left=50,width=600,height=368\'); return false"><img src="../images/facebook-large.png" width="200" height="43" alt="Share on Facebook" border="0" title="Visit the RGraph Facebook page" id="facebook_link" /></a>&nbsp;');
            document.write('<a href="https://twitter.com/_rgraph" target="_blank" onclick="window.open(\'https://twitter.com/intent/tweet?text=Check%20out%20this%20demo%20of%20RGraph:%202D/3D%20JavaScript%20charts%20-%20Free%20and%20Open%20Source%20http://www.rgraph.net' + location.pathname + '\', null, \'top=50,left=50,width=700,height=400\'); return false"><img src="../images/twitter-large.png" width="200" height="43" alt="Share on Twitter" border="0" title="Mention RGraph on Twitter" id="twitter_link" /></a>');
        </script>
    </p>


    <h1>A Line chart demonstrating  the axis options</h1>

    <button onclick="obj = getObject(); obj.Set('xaxispos', obj.Get('xaxispos') == 'bottom' ? 'center' : 'bottom'); RGraph.Redraw();">Toggle the X axis position</button>
    <button onclick="obj = getObject(); obj.Set('yaxispos', obj.Get('yaxispos') == 'left' ? 'right' : 'left'); RGraph.Redraw();">Toggle the Y axis position</button>
    <button onclick="obj = getObject(); obj.Set('ylabels', obj.Get('ylabels') ? false : true); RGraph.Redraw();">Toggle the Y axis labels</button>
    <button onclick="obj = getObject(); obj.Set('ylabels.specific', obj.Get('ylabels.specific') ? null : ['High','Medium','Low']); RGraph.Redraw();">Toggle specific Y axis labels</button>
    <button onclick="obj = getObject(); obj.Set('ymin', obj.Get('ymin') ? 0 : 50); RGraph.Redraw();">Toggle ymin (50) setting</button>
    <button onclick="obj = getObject(); obj.Set('noxaxis', obj.Get('noxaxis') ? false : true); RGraph.Redraw();">Toggle X axis </button>
    <button onclick="obj = getObject(); obj.Set('labels', obj.Get('labels') ? null : ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']); RGraph.redraw();">Toggle X labels</button>
    
    <br />

    <canvas id="cvs" width="900" height="400">[No canvas support]</canvas>
    
    <script>
        function getObject ()
        {
            return RGraph.ObjectRegistry.getFirstObjectByType('line');
        }

        window.onload = function ()
        {
            var line = new RGraph.Line({
                id: 'cvs',
                data: [65,70,74,64,58,94,75,64,68,78,64,63],
                options: {
                    ymax: 100,
                    xmax: 365,
                    labels: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
                    xaxispos: 'center',
                    textSize: 16,
                    gutterBottom: 45,
                    gutterRight: 95,
                    gutterLeft: 85,
                    textAccessible: true
                }
            }).draw();
        };
    </script>







    <p></p>

    This goes in the documents header:
    <pre class="code">
&lt;script src="RGraph.common.core.js"&gt;&lt;/script&gt;
&lt;script src="RGraph.line.js"&gt;&lt;/script&gt;
</pre>
    
    Put this where you want the chart to show up:
    <pre class="code">

&lt;button onclick="obj = getObject(); obj.Set('xaxispos', obj.Get('xaxispos') == 'bottom' ? 'center' : 'bottom'); RGraph.Redraw();"&gt;Toggle the X axis position&lt;/button&gt;
&lt;button onclick="obj = getObject(); obj.Set('yaxispos', obj.Get('yaxispos') == 'left' ? 'right' : 'left'); RGraph.Redraw();"&gt;Toggle the Y axis position&lt;/button&gt;
&lt;button onclick="obj = getObject(); obj.Set('ylabels', obj.Get('ylabels') ? false : true); RGraph.Redraw();"&gt;Toggle the Y axis labels&lt;/button&gt;
&lt;button onclick="obj = getObject(); obj.Set('ylabels.specific', obj.Get('ylabels.specific') ? null : ['High','Medium','Low']); RGraph.Redraw();"&gt;Toggle specific Y axis labels&lt;/button&gt;
&lt;button onclick="obj = getObject(); obj.Set('ymin', obj.Get('ymin') ? 0 : 50); RGraph.Redraw();"&gt;Toggle ymin (50) setting&lt;/button&gt;
&lt;button onclick="obj = getObject(); obj.Set('noxaxis', obj.Get('noxaxis') ? false : true); RGraph.Redraw();"&gt;Toggle X axis &lt;/button&gt;
&lt;button onclick="obj = getObject(); obj.Set('labels', obj.Get('labels') ? null : ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']); RGraph.redraw();"&gt;Toggle X labels&lt;/button&gt;

&lt;br /&gt;
    
&lt;canvas id="cvs" width="900" height="400"&gt;
    [No canvas support]
&lt;/canvas&gt;
</pre>

    This is the code that generates the chart:
    <pre class="code">
&lt;script&gt;
    function getObject ()
    {
        return RGraph.ObjectRegistry.getFirstObjectByType('line');
    }

    window.onload = function ()
    {
        var line = new RGraph.Line({
            id: 'cvs',
            data: [65,70,74,64,58,94,75,64,68,78,64,63],
            options: {
                ymax: 100,
                xmax: 365,
                labels: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
                xaxispos: 'center',
                textSize: 16,
                gutterBottom: 45,
                gutterRight: 95,
                gutterLeft: 85,
                textAccessible: true
            }
        }).draw();
    };
&lt;/script&gt;
</pre>



    

    <p>        
        <a href="./">&laquo; Back</a>
    </p>

</body>
</html>